﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TiposComuns.Objectos;
using System.Xml.Serialization;

namespace Servidor.Objectos.Actions
{
    [Serializable]
    public class RemoveSearchedAction : Action
    {
        private Person person;
        private byte[] key;

        public RemoveSearchedAction()
        {
            this.person = new Person();
            this.key = new byte[1];
        }

        public RemoveSearchedAction(IDMsg id, byte []key, Person person) : base(id)
        {
            this.person = person;
            this.key = key;
        }

        public Person Person
        {
            get { return person; }
            set { person = value; }
        }

        public byte[] Key
        {
            get { return key; }
            set { key = value; }
        }


        public override void Execute(User user)
        {
            user.Searched.Remove(key,person);
        }

        public override void RollBack(User user)
        {
            user.Searched.Add(key, person);
        }
    }
}
